home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / demos / xeyes / xeyes.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-15  |  2.4 KB  |  92 lines

  1. #ifndef lint
  2. static char rcsid[] = "$XConsortium: xeyes.c,v 1.8 89/07/23 11:38:03 rws Exp $";
  3. #endif /* lint */
  4.  
  5. #if defined(PROTO) || defined(PROTO1)   /* JDC 91/04/26 */
  6. #define NeedFunctionPrototypes    0
  7. #define NeedFunctionPtrPrototypes    1
  8. #include "xeyes.fd1"
  9. #endif
  10.  
  11. #ifdef PROTO
  12. #include "xeyes.fd2"
  13. #endif
  14.  
  15. #include <X11/Intrinsic.h>
  16. #include <X11/Xatom.h>
  17. #include <X11/StringDefs.h>
  18. #include <X11/Shell.h>
  19. #include "Eyes.h"
  20. #include <stdio.h> 
  21. #include "eyes.bit"
  22. #include "eyesmask.bit"
  23.  
  24.  
  25. extern void exit();
  26.  
  27. /* Command line options table.  Only resources are entered here...there is a
  28.    pass over the remaining options after XtParseCommand is let loose. */
  29.  
  30. /* Exit with message describing command line format */
  31.  
  32. void usage()
  33. {
  34.     fprintf(stderr,
  35. "usage: xeyes\n");
  36.     fprintf (stderr, 
  37. "       [-geometry [{width}][x{height}][{+-}{xoff}[{+-}{yoff}]]] [-display [{host}]:[{vs}]]\n");
  38.     fprintf(stderr,
  39. "       [-fg {color}] [-bg {color}] [-bd {color}] [-bw {pixels}]");
  40. #ifdef SHAPE
  41.     fprintf(stderr, " [-shape]");
  42. #endif
  43.     fprintf(stderr, "\n");
  44.     fprintf(stderr,
  45. "       [-outline {color}] [-center {color}] [-backing {backing-store}]\n");
  46.     exit(1);
  47. }
  48.  
  49. static XrmOptionDescRec options[] = {
  50. {"-outline",    "*eyes.outline",    XrmoptionSepArg,    NULL},
  51. {"-center",    "*eyes.center",        XrmoptionSepArg,    NULL},
  52. {"-backing",    "*eyes.backingStore",    XrmoptionSepArg,    NULL},
  53. #ifdef SHAPE
  54. {"-shape",    "*eyes.shapeWindow",    XrmoptionNoArg,        "TRUE"},
  55. #endif
  56. };
  57.  
  58. int main(argc, argv)
  59.     int argc;
  60.     char **argv;
  61. {
  62.     Widget toplevel;
  63.     Widget eyes;
  64.     Arg arg[2];
  65.     char *labelname = NULL;
  66.     int    i;
  67.     
  68.     toplevel = XtInitialize("main", "XEyes", options, XtNumber (options),
  69.                     &argc, argv);
  70.       
  71.     if (argc != 1) usage();
  72.     
  73.     i = 0;
  74.     XtSetArg (arg[i], XtNiconPixmap, 
  75.           XCreateBitmapFromData (XtDisplay(toplevel),
  76.                      XtScreen(toplevel)->root,
  77.                      eyes_bits, eyes_width, eyes_height));
  78.     i++;
  79.     XtSetArg (arg[i], XtNiconMask, 
  80.           XCreateBitmapFromData (XtDisplay(toplevel),
  81.                      XtScreen(toplevel)->root,
  82.                      eyesmask_bits, eyesmask_width, eyesmask_height));
  83.     i++;
  84.     XtSetValues (toplevel, arg, i);
  85.  
  86.     XtSetArg (arg[0], XtNlabel, &labelname);
  87.     eyes = XtCreateManagedWidget ("eyes", eyesWidgetClass, toplevel, NULL, 0);
  88.     XtGetValues(eyes, arg, 1);
  89.     XtRealizeWidget (toplevel);
  90.     XtMainLoop();
  91. }
  92.